<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>金山头条</title>
</head>
<style>
    body{
        background-color: red;
        margin: 0;
    }
    .container{
        display: flex;
        flex-direction: column;
    }
    .head{
        color: white;
    }
    .rank{
        font-size: 1rem;
        text-align: center;
    }
    .categorys{
        align-self: center;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 0.8rem;
        width: 80%;
        margin-left: 9%;
        margin-top: 2rem;
        margin-bottom: 2rem;
        
    }
    .categorys img{
        margin-top: 1px;
        width: 1rem;
        margin-right: 8px;
    }
    .categorys div{
        display: flex;
        justify-content: center;
        align-items: center;
        width: 30rem;
        height: 2rem;
        text-align: center;
        line-height: 3rem;
    }
    .c1{
        border-bottom-left-radius: 1rem;
        border-top-left-radius: 1rem;
        background-color: darkred;
    }
    .tags{
        background-color: white;
        color: white;
        height: 3rem;
        width: 100%;
        display: flex;
        font-size: 1rem;
        border-top-left-radius: 1rem;
        border-top-right-radius: 1rem;
        
    }
    .tag{
        position: absolute;
        margin-left: 1rem;
        margin-top: 0.5rem;
        width: 5rem;
        height: 2rem;
        background-color: red;
        text-align: center;
        line-height: 2rem;
        border-radius: 1rem;
    }
    .articles{
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        position: relative;
        margin-left: 1%;
        margin-right: 1%;
        background-color: lightgray;
        height: 300rem;
        border-top-left-radius: 2rem;
        border-top-right-radius: 2rem;
    }
    .article{
        display: flex;
        flex-direction: column;
        background-color: white;
        position: relative;
        border-radius: 1rem;
        font-size: 0.8rem;
        /* height: 40rem; */
        width: 90%;
        margin-left: 5%;
        margin-right: 5%;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }
    .top{
        position: absolute;
        width: 2rem;
        left: 5%;
        top: 10%;
        z-index: 3;
    }
    .mainimg{
        position: relative;
        margin-bottom: 2rem;
        width: 90%;
        left: 5%;
        top: 10%;
        border-radius: 1rem;
    }
    .topic{
        position: relative;
        left: 8%;
        margin-bottom: 5rem;
    }
    .like{
        position: absolute;
        width: 5rem;
        right: 5%;
        bottom: 2%;
    }

</style>
<body>
    <div class="container">
        <div class="head">
            <div class="rank">排行榜</div>
            <div class="categorys">
                <div class="c1"><img src="./img/icon_article.webp"><a>好文精选</a></div>
                <div class="c2"><img src="./img/icon_hot.webp"><a>热门资讯</a></div>
            </div>
        </div>
        <div class="articles">
            <div class="tags">
                <div class="tag">文章</div>
            </div>
            <div id="a1" class="article">
                <img class="top" src="./img/rank-top1.png">
                <img class="mainimg" id="img1" src="./img/pic-1.jpg">
                <div class="topic">❗❗❗拼多多百亿补贴，买啥都便宜❗❗❗</div>
                <img class="like" src="./img/like.jpg">
            </div>
            <div id="a2" class="article">
                <img class="top" src="./img/rank-top2.png ">
                <img class="mainimg" src="./img/pic-2.jpg">
                <div class="topic">蝇头小利莫贪</div>
                <img class="like" src="./img/like.jpg">
            </div>
        </div>
    </div>
</body>
<script>
    var docEl = document.documentElement;
    function setRemUnit () {
        var rem = docEl.clientWidth / 19.2; 
        docEl.style.fontSize = rem + 'px'
    }
    setRemUnit ()
    window.addEventListener ('resize', setRemUnit)
    window.addEventListener ('pageshow', function (e) {
        if (e.persisted) {
            setRemUnit()
        }
    })
</script>
</html>